# 导入fastapi包
from fastapi import FastAPI

app = FastAPI()

# 此接口仅支持post
@app.post("/login")
def login():
    return {"msg": "login success"}

# 如果想同时支持两种方法，就要换装饰器
@app.api_route("/login2", methods=['GET', 'POST'])
def login2():
    return {"msg": "login success, both GET and POST method are supported"}
